package com.house365.core.adapter;

import android.content.Context;
import android.widget.ImageView;

import com.house365.core.application.BaseApplication;
import com.house365.core.image.AsyncImageLoader;
import com.house365.core.image.CacheImageUtil;
import com.house365.core.image.CacheImageUtil.ImageOperate;

public abstract class BaseCacheExpandableListAdapter<R,T> extends BaseExpandableListAdapter<R,T> {

	private BaseApplication mApplication;
	private AsyncImageLoader mAil;
	protected Context context;
	public BaseCacheExpandableListAdapter(Context context) {
		super();
		this.context = context;
		mApplication = (BaseApplication)context.getApplicationContext();
		mAil = new AsyncImageLoader(context);
	}

	public void clear() {
		super.clear();
		//mAil.clearCacheImage();
	}
	
	public void setCacheImage(final ImageView imageView,String imageUrl,final int resId,int scaleType) {
		CacheImageUtil.setCacheImage(imageView, imageUrl, resId, scaleType, mAil);
	}
	public void setCacheImageWithImageOper(final ImageView imageView,String imageUrl,final int resId,int scaleType,ImageOperate imageOperate){
		CacheImageUtil.setCacheImageWithImageOper(imageView, imageUrl, imageOperate , context.getResources(), resId, scaleType, mAil);
	}
	public void setCacheImageWithoutDef(final ImageView imageView,String imageUrl,int scaleType){
		CacheImageUtil.setCacheImageWithoutDef(imageView, imageUrl, scaleType, mAil);
	}
//	public void setCacheImageFromDisk(final ImageView imageView,String imageUrl,final int resId,int scaleType) {
//		CacheImageUtil.setCacheImageFromDisk(imageView, imageUrl, resId, scaleType, mAil);
//	}
}
